home *** CD-ROM | disk | FTP | other *** search
/ Programmer Plus 2007 / Programmer-Plus-2007.iso / Programming / XML Utilities / Professional Programmer XSL IDE / Xselerator25.msi / Data.Cab / F39436_buildListWhile.xsl < prev    next >
Encoding:
Extensible Markup Language  |  2002-02-06  |  2.4 KB  |  63 lines

  1. <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  2. xmlns:xalan="http://xml.apache.org/xalan"
  3. exclude-result-prefixes="xsl xalan"
  4. >
  5.   <xsl:template name="buildListWhile">
  6.     <xsl:param name="pGenerator" select="/.."/>
  7.     <xsl:param name="pParamGenerator" select="/.."/>
  8.     <xsl:param name="pController" select="/.."/>
  9.     <xsl:param name="pParam0" select="/.."/>
  10.     <xsl:param name="pContollerParam" select="/.."/>
  11.     <xsl:param name="pElementName" select="'el'"/>
  12.     <xsl:param name="pList" select="/.."/>
  13.  
  14.     <xsl:if test="not($pController)">
  15.       <xsl:message terminate="yes">
  16.       [buildListWhile]Error: No pController specified:
  17.          would cause infinite processing.
  18.       </xsl:message>
  19.     </xsl:if>   
  20.     
  21.     <xsl:variable name="vElement">
  22.       <xsl:element name="{$pElementName}">
  23.       <xsl:apply-templates select="$pGenerator">
  24.         <xsl:with-param name="pParams" select="$pParam0"/>
  25.         <xsl:with-param name="pList" select="$pList"/>
  26.         <xsl:with-param name="pParamGenerator" select="$pParamGenerator"/>
  27.       </xsl:apply-templates>
  28.       </xsl:element>
  29.     </xsl:variable>
  30.     
  31.     <xsl:variable name="newList">
  32.       <xsl:copy-of select="$pList"/>
  33.       <xsl:copy-of select="xalan:nodeset($vElement)/*"/>
  34.     </xsl:variable>
  35.     
  36.     <xsl:variable name="vResultList" select="xalan:nodeset($newList)/*"/>
  37.     
  38.     <xsl:variable name="vAccept">
  39.       <xsl:apply-templates select="$pController">
  40.         <xsl:with-param name="pList" select="$vResultList"/>
  41.         <xsl:with-param name="pParams" select="$pContollerParam"/>
  42.       </xsl:apply-templates>
  43.     </xsl:variable>
  44.     
  45.     <xsl:choose>
  46.       <xsl:when test="not(string($vAccept))">
  47.         <xsl:copy-of select="$pList"/>
  48.       </xsl:when>
  49.       <xsl:otherwise>
  50.         <xsl:call-template name="buildListWhile">
  51.             <xsl:with-param name="pGenerator" select="$pGenerator"/>
  52.             <xsl:with-param name="pParamGenerator" select="$pParamGenerator"/>
  53.             <xsl:with-param name="pController" select="$pController"/>
  54.             <xsl:with-param name="pContollerParam" select="$pContollerParam"/>
  55.             <xsl:with-param name="pParam0" select="$pParam0"/>
  56.             <xsl:with-param name="pElementName" select="$pElementName"/>
  57.             <xsl:with-param name="pList" select="$vResultList" />
  58.         </xsl:call-template>
  59.       </xsl:otherwise>
  60.     </xsl:choose>
  61.   </xsl:template>
  62.  
  63. </xsl:stylesheet>